    <script type="text/javascript" src="http://connect.facebook.net/en_US/all.js"></script>
    <script type="text/javascript">
        FB.init({
            appId  : '<?php echo $fbconfig['appid']?>',
            status : true, // check login status
            cookie : true, // enable cookies to allow the server to access the session
            xfbml  : true  // parse XFBML
        });
        
        function streamPublish(name, description, hrefTitle, hrefLink, userPrompt){        
            FB.ui({ method : 'feed', 
                    message: userPrompt,
                    link   :  hrefLink,
                    caption:  hrefTitle,
                    picture: 'http://thinkdiff.net/ithinkdiff.png'
           });
           //http://developers.facebook.com/docs/reference/dialogs/feed/

        }
        function publishStream(){
            streamPublish("Stream Publish", 'Checkout iOS apps and games from iThinkdiff.net. I found some of them are just awesome!', 'Checkout iThinkdiff.net', 'http://ithinkdiff.net', "Demo Facebook Application Tutorial");
        }

        function newInvite(){
             var receiverUserIds = FB.ui({ 
                    method : 'apprequests',
                    message: 'Come on man checkout my applications. visit http://ithinkdiff.net'
             },
             function(receiverUserIds) {
                      console.log("IDS : " + receiverUserIds.request_ids);
                    }
             );
             //http://developers.facebook.com/docs/reference/dialogs/requests/
        }
    </script>

    <!-- all time check if user session is valid or not -->
    
    <?php if ($fb_user){ ?>
        <table border="0" cellspacing="3" cellpadding="3">
            <tr>
                <td>
                    <!-- Data retrived from user profile are shown here -->
                    <div class="box">
                        <b>User Information using Graph API</b>
                        <?php $user_info = $sf_data->getRaw('fb_user_info');
                            echo $user_info['name']; 
                        ?>
                    </div>
                </td>
            </tr>
        </table>
    <?php } ?>
